package com.zywl.web.utils.tags;

import com.zywl.core.beans.Resource;
import com.zywl.service.ResourceService;
import com.zywl.utils.utils.SpringContextUtil;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;

import java.util.List;

public class OprationTrans {
    private static final Logger logger = Logger.getLogger(OprationTrans.class);

    public static boolean hasSons(String menuId) {
        if (StringUtils.isNotEmpty(menuId)) {
            ResourceService resourceService = SpringContextUtil.getBean(ResourceService.class);
            try {
                List<Resource> resources = resourceService.getResourcesMenuByPid(menuId);
                if (resources != null && !resources.isEmpty()) {
                    return true;
                }
            } catch (Exception e) {
                logger.error("查询子权限异常", e);
            }
        }
        return false;
    }
}
